//剑指offer最后一道题：剪绳子
//思路:https://blog.nowcoder.net/n/915eab44a70b49ef92abdc93f8993432?f=comment

public class Solution{
	public int cutRope(int target){
		if(target<=0)return 0;
		if(target==1||target==2)return 1;
		if(target==3)return 2;
		int m=target%3;
		switch(m){
			case 0:
			return (int)Math.pow(3,target/3);
			case 1:
			return (int)Math.pow(3,(target/3)-1)*4;
			case 2:
			return (int)Math.pow(3,target/3)*2;
		}
	return 0;
	}
}